package www.superbytecode.com.iframe;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.control.Alert;
import org.mybatis.generator.api.ProgressCallback;

/**
 * All rights Reserved, Designed By www.super-bytecode.com
 *
 * @ProjectName superbytecode-builder
 * @Package www.superbytecode.com.iframe
 * @ClassName UIProgressCallback
 * @Description
 * @Author [Lance Ting]
 * @Date 2020/7/14 20:37
 * @Version V1.0
 * @Copyright: 2020 www.super-bytecode.com Inc. All rights reserved.
 * @TODO：本文件Lance Ting所作, 如果转载或使用请标明具体出处!
 **/
public class UIProgressCallback extends Alert implements ProgressCallback {

    private StringProperty progressText = new SimpleStringProperty();

    public UIProgressCallback(AlertType alertType) {
        super(alertType);
        this.contentTextProperty().bindBidirectional(progressText);
    }

    @Override
    public void introspectionStarted(int totalTasks) {
        progressText.setValue("开始代码检查");
    }

    @Override
    public void generationStarted(int totalTasks) {
        progressText.setValue("开始代码生成");
    }

    @Override
    public void saveStarted(int totalTasks) {
        progressText.setValue("开始保存生成的文件");
    }

    @Override
    public void startTask(String taskName) {
        progressText.setValue("代码生成任务开始");
    }

    @Override
    public void done() {
        progressText.setValue("代码生成完成");
    }

    @Override
    public void checkCancel() throws InterruptedException {
    }
}